package com.xxrl.shop.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @author mis
 *
 * 账户余额
 * 账户积分
 * 用户地址
 * 用户的个人描述
 */
@ApiModel(description = "Detail user information.")
@Data
@Entity
@Table(name = "sp_user_info")
@EntityListeners(AuditingEntityListener.class)
public class UserInfo implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(notes = "Unique identifier of the UserInfo.", example = "1",
            required = true)
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id")
    @ToString.Exclude
    private User user;

    private Integer money;
    private Integer credit;
    private String content;

    @CreatedDate
    private Long createTime;

    @LastModifiedDate
    private Long lastModifiedTime;
}
